/**
 * 
 */
package com.ap.paymentdetails;

import static com.ap.datagen.core.Nullable.nullable;

import com.ap.core.cxf.jaxb.paymentdetails.AbstractPaymtDetailsTypeGeneratorBuilder;
import com.ap.core.cxf.jaxb.paymentdetails.PaymtDetailsType;
import com.ap.core.util.JaxbUtil;
import com.ap.datagen.Generator;
import com.ap.datagen.core.GeneratorHelper;
import com.ap.generator.common.FieldGenerator;
import com.ap.generator.common.QkPayDeliveryAddressGeneratorBuilder;

/**
 * @author Rohit.Dixit
 * 
 */
public class PaymtDetailsTypeGeneratorBuilder extends
AbstractPaymtDetailsTypeGeneratorBuilder {

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.ap.xsd.paymentdetails.AbstractPaymtDetailsTypeGeneratorBuilder#
	 * setupDefaults()
	 */
	@Override
	public void setupDefaults() {
		this.apTransactionIdGenerator = FieldGenerator.APTRANSACTIONIDGENERATOR;
		this.fasterPaymentsRefGenerator = FieldGenerator.FASTERPAYMENTSREFGENERATOR;
		this.paymentStatusInfoGenerator = nullable(GeneratorHelper
				.buildA(PaymentStatusTypeGeneratorBuilder
						.getPaymentStatusTypeGeneratorBuilder()));
		this.qkPayDelAddressGenerator = nullable(GeneratorHelper
				.buildA(QkPayDeliveryAddressGeneratorBuilder
						.getDeliveryAddressGenerator()));
		this.adhocInfoGenerator = FieldGenerator.ADHOCGENERATOR;
	}

	/**
	 * 
	 * @return
	 */
	public static PaymtDetailsTypeGeneratorBuilder getPaymtDetailsTypeGeneratorBuilder() {
		return new PaymtDetailsTypeGeneratorBuilder();
	}

	public PaymtDetailsTypeGeneratorBuilder withApTransactionIdGenerator(
			Generator<String> apTransactionIdGenerator) {
		this.apTransactionIdGenerator = nullable(apTransactionIdGenerator);
		return this;
	}
	
	/**
	 * 
	 * @return
	 */
	public PaymtDetailsType getPaymtDetailsType() {
		PaymtDetailsType paymtDetailsType = getPaymtDetailsTypeGeneratorBuilder()
				.build().generate();
		return paymtDetailsType;
	}
	
	public static void main(String arg[]){
		JaxbUtil jaxb = JaxbUtil.newInstance();
		jaxb.javaToXML(PaymtDetailsType.class, PaymtDetailsTypeGeneratorBuilder.getPaymtDetailsTypeGeneratorBuilder().build().generate());	
	}

}
